package com.wuyangnju.lj.callcenter.util;

/******************************************************************
 * \ File: LognormalConvert.java for Queueing System Language: Java 1.6
 * Copyright: Jiheng Zhang, Hong Kong University of Science and Technology Date:
 * March 4, 2011 \
 ******************************************************************/

public class LognormalConvert {

	public double mu, sigma;
	public double mean, var;

	public LognormalConvert(double m, double s, boolean b) {
		if (b) {
			mean = m;
			var = s;

			double temp = Math.log(1. + var / (mean * mean));
			mu = Math.log(mean) - .5 * temp;
			sigma = Math.sqrt(temp);

		} else {
			mu = m;
			sigma = s;

			mean = Math.exp(mu + 0.5 * sigma * sigma);
			var = (Math.exp(sigma * sigma) - 1)
					* Math.exp(2 * mu + sigma * sigma);

		}

	}

}
